package stack;

import java.util.HashMap;
import java.util.Iterator;

public class StackOfLinked<Item> implements Iterable<Item> {

    int count = 0;

    private Node head;

    private class Node{
        Item item;
        Node next;

        public Node(Item item){
            this.item = item;
        }
    }

    public void push(Item item){
        Node oldHead = head;
        head = new Node(item);
        head.next = oldHead;
        count ++;
    }

    public void pop(){
        if(count <= 0){
            return;
        }
        Node newHead = head.next;
        head = newHead;
        count --;
    }

    public Iterator<Item> iterator() {
        return null;
    }
}
